<template>
  <div>
    <span />
  </div>
</template>
<script>
import { setWaterMark, removeWatermark } from '@/components/File/watermark/watermark.js'
import { getLoginUser } from '@/api/system/user'
export default {
  name: 'Watermark',
  props: {
    width: {
      type: Number,
      default: 1300
    },
    height: {
      type: Number,
      default: 800
    }
  },
  data() {
    return {
      timeClock: undefined,
      userData: {}
    }
  },
  created() {
    getLoginUser().then(response => {
      this.userData = response.data
      this.setWaterMark()
      this.timeClock = setInterval(() => {
        this.setWaterMark()
      }, 5000)
    })
  },
  destroyed() {
    clearInterval(this.timeClock)
    removeWatermark()
  },
  methods: {
    // 设置水印
    setWaterMark() {
      setWaterMark(this.userData.nickName + '  ' + this.userData.email, '', '', this.width, this.height)
    }
  }
}
</script>

<style scoped>

</style>
